#ifndef __NK_IPC_H__
#define __NK_IPC_H__

#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <netinet/in.h>
#include <linux/tipc.h>


enum nk_ipc_mod {
	NK_IPC_MOD_DP,
	NK_IPC_MOD_CLI,
	NK_IPC_MOD_MGD,
	NK_IPC_MOD_DEBUG,
	NK_IPC_MOD_LOG,
	NK_IPC_MOD_NUM,
};


/* massage type */
enum nk_ipc_msg_type {
	NK_IPC_MSG_TYPE_UNI = TIPC_RESERVED_TYPES,	/* for unicast */
	NK_IPC_MSG_TYPE_SYSTEM,
	NK_IPC_MSG_TYPE_LANG,
	NK_IPC_MSG_TYPE_NUM,
};


struct nk_ipc_head {
	int type;
	int sender;
	unsigned len;
	char body[0];
};

extern int nk_ipc_init(int mod);
extern int nk_ipc_send(int mid, char *buf, int len);
extern int nk_ipc_recv(char *buf, int len);

static inline int nk_ipc_get_len(struct nk_ipc_head *head)
{
	return head->len;
}

static inline int nk_ipc_get_type(struct nk_ipc_head *head)
{
	return head->type;
}

static inline int nk_ipc_get_sender(struct nk_ipc_head *head)
{
	return head->sender;
}



#endif /* __NK_IPC_H__ */
